#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
//void Func1()
//{
//	int a = 0;
//	printf("%p\n", &a);
//}
//void Func2()
//{
//	int n = 0;
//	printf("%p", &n);
//}
//int main()
//{
//	Func1();
//	Func2();
//}
#include "SeqList.h"
void TestSeqList5()
{
	SL sl;
	SLInit(&sl);
	SLPushBack(&sl, 1);
	SLPushBack(&sl, 2);
	SLPushBack(&sl, 3);
	SLPushBack(&sl, 4);
	SLPushBack(&sl, 5);
	SLPrint(&sl);

	SLErase(&sl, 2);
	SLPrint(&sl);

	int x;
	scanf("%d", &x);
	int pos = SLFind(&sl, x);
	if (pos != -1)
	{
		SLErase(&sl, pos);
	}
	SLPrint(&sl);
	SLDestroty(&sl);

}
void TestSeqList4()
{
	SL sl;
	SLInit(&sl);
	SLPushBack(&sl, 1);
	SLPushBack(&sl, 2);
	SLPushBack(&sl, 3);
	SLPushBack(&sl, 4);
	SLPushBack(&sl, 5);
	SLPushFront(&sl, -1);
	SLPushFront(&sl, -2);
	SLPrint(&sl);

	SLInsert(&sl, 3, 40);
	SLPrint(&sl);

	int x;
	scanf("%d", &x);
	int pos = SLFind(&sl, x);
	if (pos != -1)
	{
		SLInsert(&sl, pos, x * 10);
	}
	SLPrint(&sl);

	SLDestroty(&sl);

}
void menu()
{
	printf("********************\n");
	printf("1,头插   2,尾插      \n");
	printf("3,头删   4,尾删      \n");
	printf("7、打印  -1、退出     \n");
	printf("********************\n");
}
int main()
{

	SL s;
	SLInit(&s);
	int option = 0;
	do
	{
		menu();
		scanf("%d", &option);
		if (option == 1)
		{
			int m = 0;
			int n = 0;
			printf("输入几个数并依次输入数值\n");
			scanf("%d", &m);
			for (int i = 0; i < m; i++)
			{
				scanf("%d", &n);
				SLPushFront(&s, n);
			}
		}
		else if (option == 2)
		{
			int m = 0;
			int n = 0;
			printf("输入几个数并依次输入数值\n");
			scanf("%d", &m);
			for (int i = 0; i < m; i++)
			{
				scanf("%d", &n);
				SLPushBack(&s, n);
			}

		}
		else if (option == 3)
		{
			SLPopFront(&s);
			printf("头删一个值\n");
		}
		else if (option == 4)
		{
			SLPopBack(&s);
			printf("尾删一个值\n");

		}
		else if (option == 7)
		{
			SLPrint(&s);

		}
	} while (option!=-1);

	SLDestroty(&s);
	return 0;
	//SLPushBack(&s, 1);
	//SLPushBack(&s, 2);
	//SLPushBack(&s, 3);
	//SLPushBack(&s, 4);
	//SLPushBack(&s, 5);
	//SLPushBack(&s, 6);
	//SLPrint(&s);
	//SLInsert(&s,3, 4);
	//SLPopFront(&s);
	//SLPopFront(&s);
	//SLPopFront(&s);
	//SLPushFront(&s, 3);
	//int x = 0;
	//scanf("%d", &x);
	//int pos = SLFind(&s, x);
	//if (pos != -1)
	//{
	//	SLInsert(&s,pos, x*10);
	//}
	//SLErase(&s, 2);
	//SLModify(&s, 3, 2);
	//SLPrint(&s);

}